cmake_minimum_required(VERSION 3.22) #指定最低版本
#项目名称
project(CMAKE_TEST_PROJECT)
#构建类型，默认为release，debug下可以断点调试
set(CMAKE_BUILD_TYPE "Debug")

#添加opencv目录
set(CMAKE_PREFIX_PATH "D:/projects/opencv410/opencv-build/install")
# 查找 OpenCV 库
find_package(OpenCV REQUIRED)

# 调试信息
message(STATUS "OpenCV Include Directories: ${OpenCV_INCLUDE_DIRS}")

# 包含 OpenCV 的头文件路径 及本项目头文件路径
include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/include ${OpenCV_INCLUDE_DIRS})

#源文件路径，有多少路径就添加多少个
aux_source_directory(src  SRC_LIST)

#设置输出文件路径
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build)

#设置生成的可执行文件的名称
add_executable(output ${SRC_LIST})

# 链接 OpenCV 库
target_link_libraries(output ${OpenCV_LIBS})